import * as React from 'react';
import { Select } from 'antd';
import { SelectProps } from 'antd/lib/select';

const Option = Select.Option;

export interface SearchInputProps extends SelectProps {
    options?: {
        id: string;
        name: string;
    }[];
}

export class SearchInput extends React.Component<SearchInputProps, {}> {

    render() {
        const options = this.props.options && this.props.options.map(d => <Option key={d.id}>{d.name}</Option>);
        return <Select
            {...this.props}
            combobox
            notFoundContent=""
            defaultActiveFirstOption={false}
            filterOption={false}
        >
            {options}
        </Select>;
    }
}